/**
 * @description 判断当前浏览器环境是IOS | Android | PC
 * @return {*}  "IOS" | "Android" | "PC"
 */
export const judgeClient = (): "IOS" | "Android" | "PC" => {
  let u = navigator.userAgent;
  console.log(u);
  let isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //判断是否是 android终端
  let isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //判断是否是 iOS终端
  console.log("是否是Android：" + isAndroid); //true,false
  console.log("是否是iOS：" + isIOS);
  if (isAndroid) {
    return "Android";
  } else if (isIOS) {
    return "IOS";
  } else {
    return "PC";
  }
};

/**
 * @description 判断当前IOS版本
 * @return {*}  string
 */
export const getVersion = (): string => {
  let u = navigator.userAgent.toLowerCase();
  console.log(u);
  const li = u.match(/cpu iphone os (.*?) like mac os/);
  console.log(li);
  if (li) {
    return li[1];
  }
  return "";
};
